package com.neu.service;

import com.neu.dao.CheckInDao;
import com.neu.pojo.CheckIn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CheckInServiceImpl implements CheckInService{
    @Autowired
    private CheckInDao checkInDao;

    /**
     * 获取全部入住信息
     */
    @Override
    public List<CheckIn> getCheckInList() {
        return checkInDao.getCheckInList();
    }

    /**
     * 根据入住号删除入住信息
     * @param checkInNum
     * @return
     */
    @Override
    public int delCheckIn(int checkInNum) {
        return checkInDao.delCheckIn(checkInNum);
    }

    /**
     * 根据入住号修改入住信息
     * @param checkIn
     * @return
     */
    @Override
    public int updateCheckIn(CheckIn checkIn) {
        return checkInDao.updateCheckIn(checkIn);
    }

    /**
     * 新增入住信息
     * @param checkIn
     * @return
     */
    @Override
    public int addCheckIn(CheckIn checkIn) {
        return checkInDao.addCheckIn(checkIn);
    }

    @Override
    public int getCheckInCount() {
        return checkInDao.getCheckInCount();
    }

    @Override
    public List<CheckIn> getCheckInByPage(int page, int limit) {
        return checkInDao.getCheckInByPage((page-1)*limit,limit);
    }

    @Override
    public CheckIn getCheckInByTel(long tel) {
        return checkInDao.getCheckInByTel(tel);
    }

}

